package cn.shyouchi.wuguanjia.android.ui.patrol.statistic;

import android.content.Intent;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.widget.hintprogressbar.HintProgressBar;

/**
 * Created by Eenie on 2016/12/29 at 12:34
 * Email: 472279981@qq.com
 * Des:
 */

public class PatrolStatisticAdapter extends BaseQuickAdapter<PatrolStatisticEntity.ResultMessageBean, BaseViewHolder> {
    public PatrolStatisticAdapter(List<PatrolStatisticEntity.ResultMessageBean> data) {
        super(R.layout.item_patrol_statistic, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, final PatrolStatisticEntity.ResultMessageBean entity) {

//        mPointProgress.setProgress(patrolRateEntity.getResultMessage().getTurn());
//        mTurnProgress.setProgress(patrolRateEntity.getResultMessage().getNumber());
//
//
//        mTvTurnComplete.setText(String.format("圈数：%s/%s", patrolRateEntity.getResultMessage().getTurn_ring(), patrolRateEntity.getResultMessage().getRing()));
//        mTvPointComplete.setText(String.format("点数：%s/%s", patrolRateEntity.getResultMessage().getTurn_actual(), patrolRateEntity.getResultMessage().getTurn_total()));


        holder.setText(R.id.tv_report_name, entity.getUser().getName());
        holder.setText(R.id.tv_report_time, entity.getDate());

        holder.setText(R.id.tv_turn_complete,String.format("圈数：%s/%s", entity.getRate().getTurn_ring(), entity.getRate().getRing()));

        HintProgressBar turnPro = holder.getView(R.id.turn_progress);
        turnPro.setProgress(entity.getRate().getTurn());

//        holder.setText(R.id.tv_point_total, String.format("总点数：%1s", entity.getRate().getNumber()));
        holder.setText(R.id.tv_point_complete,String.format("点数：%s/%s", entity.getRate().getTurn_actual(), entity.getRate().getTurn_total()));


        HintProgressBar pointPro = holder.getView(R.id.point_progress);
        pointPro.setProgress(entity.getRate().getNumber());


        holder.getView(R.id.tv_check_detail).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, PreviewPatrolRingActivity.class);
                intent.putExtra("info", entity);
                mContext.startActivity(intent);
            }
        });
    }
}
